package com.para.esc.httpPostAuth;

import java.util.List;

import res.roleESB_1.JsonResRole;
import res.roleESB_1.OutputParameters1;
import res.roleESB_1.RESULT_MSG;
import res.roleESB_1.X_RESULT_TB1;
import res.roleESB_1.X_RESULT_TB_ITEM1;




import com.alibaba.fastjson.JSON;
import com.google.gson.Gson;

public class RoleESB {
	public static String roleESB(String data ,String url){
		HttpPostBascAuth httpPostBascAuth = new HttpPostBascAuth();
		String res=httpPostBascAuth.send(data, url);
		return res;
		
		
	}
	public static void main(String[] args) {
		String data_role ="{\"DEAL_SSO_RESPS_Input\": {\"@xmlns\": \"http://xmlns.oracle.com/apps/cux/rest/DEALSSORESPS/deal_sso_resps/\",\"RESTHeader\": {\"@xmlns\": \"http://xmlns.oracle.com/apps/cux/rest/DEALSSORESPS/header\",\"Responsibility\": \"\",\"RespApplication\": \"\",\"SecurityGroup\": \"\",\"NLSLanguage\": \"SIMPLIFIED CHINESE\",\"Org_Id\": \"0\"},\"InputParameters\": {\"P_SSO_RESP_INFO_IN_TB\": {\"P_SSO_RESP_INFO_IN_TB_ITEM\": [{\"PR_TYPE\": \"1\",\"L_RESP_INFO\": {\"L_RESP_INFO_ITEM\": [{\"PR_ACCOUNTNO\": \"\",\"RESPONSIBILITY_ID\": \"\",\"RESP_APPL_ID\": \"\"}]}}]}}}}";
		String url_role = "http://10.0.6.5:8080/webservices/rest/DEALSSORESPS/DEAL_SSO_RESPS/";
		String res=roleESB(data_role,url_role);
		System.out.println(res);
		
//		Gson gson = new Gson();
//		JsonResRole jsonResRole = gson.fromJson(res,JsonResRole.class);
		JsonResRole jsonResRole = JSON.parseObject(res, JsonResRole.class);
        OutputParameters1 outputParameters=jsonResRole.getOutputParameters();
        
        X_RESULT_TB1 x_RESULT_TB = outputParameters.getX_RESULT_TB();
        List<X_RESULT_TB_ITEM1> list = x_RESULT_TB.getX_RESULT_TB_ITEM();
        for(X_RESULT_TB_ITEM1 x_RESULT_TB_ITEM:list){
        	String responsibility_ID = x_RESULT_TB_ITEM.getRESPONSIBILITY_ID();
        	String responsibility_NAME = x_RESULT_TB_ITEM.getRESPONSIBILITY_NAME();
        	String resp_APPL_ID = x_RESULT_TB_ITEM.getRESP_APPL_ID();
        	RESULT_MSG result_MSG = x_RESULT_TB_ITEM.getRESULT_MSG();
        	String result_STATUS = x_RESULT_TB_ITEM.getRESULT_STATUS();
        	System.out.println(result_STATUS);
        	System.out.println(responsibility_ID);
        }
	   
	  
		
	}

}
